package com.yh.csx.business.core.config;

import org.springframework.boot.ApplicationArguments;
import org.springframework.core.annotation.Order;

import com.alibaba.fastjson.parser.ParserConfig;
import com.yh.csx.bsf.core.util.PropertyUtils;

/**
 * Fastjson autotype 白名单全局设置（后续不建议使用fastjson，由于安全问题）
 * @author Wang.zhibin
 * @date 2021-01-18
 * */
@Order
public class FastJsonApplicationSetting implements org.springframework.boot.ApplicationRunner {

    public static final String FASTJSON_WHITE_LIST="bsf.fastjson.autotype.whitelist";
    @Override
    public void run(ApplicationArguments var1) throws Exception {
        //设置FASTJSON autotype序列化白名单        
        ParserConfig.getGlobalInstance().addAccept(PropertyUtils.getPropertyCache(FASTJSON_WHITE_LIST,  "com.yh.csx.")); 
    }
}
